# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Pierre Schmitz <pierre@archlinux.de>

pkgname=devtools-git-poc
pkgver=20230423
pkgrel=1
pkgdesc='Tools for Arch Linux package maintainers - Experimental git POC edition'
arch=('any')
license=('GPL')
url='https://gitlab.archlinux.org/archlinux/devtools'
depends=(
  arch-install-scripts
  awk
  bash
  binutils
  coreutils
  diffutils
  findutils
  grep
  jq
  openssh
  parallel
  rsync
  sed
  util-linux

  bzr
  git
  mercurial
  subversion

  devtools
)
makedepends=(
  asciidoc
  shellcheck
)
optdepends=('btrfs-progs: btrfs support')
_commit=a317b2e7de0c942b9c0d52b805dc05f5e7a32cbc
source=("${pkgname}::git+https://gitlab.archlinux.org/archlinux/devtools.git#commit=${_commit}"
  "pkgctl")
validpgpkeys=(
  'E240B57E2C4630BA768E2F26FC1B547C8D8172C8' # Levente Polyak <anthraxx@archlinux.org>
)
sha256sums=('SKIP'
            'c9675a0c7b6d35a6d401e78fc341bae051aff40fbe4b6fe4236b49922deb1a0d')

prepare() {
  cd "${pkgname}"
  sed -i 's/repos-git.archlinux.org/repos.sandbox.archlinux.org/' src/lib/common.sh
}


build() {
  cd ${pkgname}
  make DATADIR="/usr/local/share/devtools-git-poc" PREFIX="/usr/local/share/devtools-git-poc" BUILDTOOLVER="${pkgver}-${pkgrel}-${arch}"
}

package() {
  cd ${pkgname}
  install -d "${pkgdir}/usr/local/share/${pkgname}"
  cp -rf build/* "${pkgdir}"/usr/local/share/${pkgname}/
  install -Dm755 ../pkgctl "${pkgdir}"/usr/bin/pkgctl
  cp -rf build/* "${pkgdir}"/usr/local/share/${pkgname}/
  install -Dm755 build/contrib/completion/zsh/_devtools "${pkgdir}/usr/share/zsh/site-functions/_pkgctl"
  install -Dm755 build/contrib/completion/bash/devtools "${pkgdir}/usr/share/bash-completion/completions/pkgctl"
  install -Dm 644 "${pkgdir}/usr/local/share/devtools-git-poc/doc/man/"pkgctl* -t "${pkgdir}"/usr/share/man/man1/
}

# vim: ts=2 sw=2 et:
